package com.itheima.controller;

import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@AllArgsConstructor
@RequestMapping("report")
public class ReportController {

    private final ReportService reportService;

    /**
     * 商品上下架统计
     * @return
     */
    @GetMapping("/productUpOrDown")
    public Result productUpOrDown(){
        List<Map<String,Object>> dataList = reportService.productUpOrDown();
        return Result.success(dataList);
    }

    /**
     * 商品状态统计
     * @return
     */
    @GetMapping("/productStatus")
    public Result productStatus(){
        List<Map<String,Object>> dataList = reportService.productStatus();
        return Result.success(dataList);
    }
}
